package exemple;

import org.python.util.*;
import org.python.core.*;

import java.io.*;

public class CallPythonFromJava {

	
	public static File _example;
	public static String _path;
	
	public static void main(String[] args) {

		_path = "C:/Documents and Settings/Jose Antonio/workspace/STI/src/exemple/youtube-dl.py";
		System.out.println("1: "+_path);
		try{
			_example = new File(_path).getCanonicalFile();
		} catch (IOException ioe) {
			System.out.println("ERROR 1: "+ioe.toString());
		}
		_path = _example.getPath();
		System.out.println("2: "+_path);
		PythonInterpreter pyinterp = new PythonInterpreter();
		try{		
			pyinterp.execfile(_path);
		} catch (PyException pye){
			System.out.println("ERROR 2: "+pye.toString());
			System.exit(0);
		}
		System.out.println("example.py executed successfully.");
	}
}
